﻿#region 头注释
/******************************************************************************
文件名称    :   ChemistryService.cs
创建日期    :   2011-4-23 21:59:50
功能描述    :   Chemistry实体数据服务类
修改日志    :   
    2011-04-23 21:59  马利
*******************************************************************************/
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using Stone.Components.Entities;
using Dare.Utilities.Data;
using Stone.Data.Providers;

namespace Stone.Services.EntityServices
{
    /// <summary>
    /// Chemistry实体数据服务类
    /// </summary>
    public class ChemistryService : EntityServiceTemplate<Chemistry, long, ChemistryDataProvider>
    {
        public ChemistryService(Application app)
            : base(app)
        {
        }

        public bool DeleteChemistryInfo(Chemistry chem)
        {
            ChemistryService chemService = Stone.Services.Application.Instance.GetDbService<ChemistryService>();
            ChemistryUrine24hService chem24hurineService = Stone.Services.Application.Instance.GetDbService<ChemistryUrine24hService>();
            ChemistryBiochemistryService chemBiochemistryService = Stone.Services.Application.Instance.GetDbService<ChemistryBiochemistryService>();
            ChemistryBloodService chemBloodService = Stone.Services.Application.Instance.GetDbService<ChemistryBloodService>();
            ChemistryCruorService chemCruorService = Stone.Services.Application.Instance.GetDbService<ChemistryCruorService>();
            ChemistryImmunityService chemImmunityService = Stone.Services.Application.Instance.GetDbService<ChemistryImmunityService>();
            ChemistryLymphocyteService chemLymphocyteService = Stone.Services.Application.Instance.GetDbService<ChemistryLymphocyteService>();
            ChemistryUrineService chemUrineService = Stone.Services.Application.Instance.GetDbService<ChemistryUrineService>();

            try
            {
                if (chem.ChemistryBiochemistryId.HasValue) chemBiochemistryService.Delete(chem.ChemistryBiochemistryId.Value);
                if (chem.ChemistryBloodId.HasValue) chemBloodService.Delete(chem.ChemistryBloodId.Value);
                if (chem.ChemistryCruorId.HasValue) chemCruorService.Delete(chem.ChemistryCruorId.Value);
                if (chem.ChemistryImmunityId.HasValue) chemImmunityService.Delete(chem.ChemistryImmunityId.Value);
                if (chem.ChemistryLymphocyteId.HasValue) chemLymphocyteService.Delete(chem.ChemistryLymphocyteId.Value);
                if (chem.ChemistryUrine24hId.HasValue) chem24hurineService.Delete(chem.ChemistryUrine24hId.Value);
                if (chem.ChemistryUrineId.HasValue) chemUrineService.Delete(chem.ChemistryUrineId.Value);

                return Delete(chem.Id);
            }
            catch
            {
                return false;
            }
        }

    }
}
